package es.deusto.eside.programacion4.mario2d.model;

import org.newdawn.slick.Animation;
import org.newdawn.slick.SpriteSheet;

/**
 * Clase basica de personajes
 * 
 * @author Sergio
 * 
 */
public class BasicCharacter {
	/**
	 * Animacion de andar
	 */
	private Animation walk;
	/**
	 * Posicion X
	 */
	private int positionX;
	/**
	 * Posicion Y
	 */
	private int positionY;

	private Animation walkBehind;

	private boolean isDead = false;

	/**
	 * @return the isDead
	 */
	public boolean isDead() {
		return isDead;
	}

	/**
	 * @param isDead
	 *            the isDead to set
	 */
	public void setDead(boolean isDead) {
		this.isDead = isDead;
	}

	/**
	 * @param positionX
	 *            the positionX to set
	 */
	public void setPositionX(int positionX) {
		this.positionX = positionX;
	}

	/**
	 * @param positionY
	 *            the positionY to set
	 */
	public void setPositionY(int positionY) {
		this.positionY = positionY;
	}

	private Animation current;

	/**
	 * Constructor
	 * 
	 * @param s
	 *            spritesheet pj
	 * @param pX
	 *            posicion x
	 * @param pY
	 *            posicion y
	 * @param frames
	 *            numero de frames
	 * @param time
	 *            verlocidad de cambio de sprite
	 */
	public BasicCharacter(SpriteSheet s, int pX, int pY, int frames, int time) {
		walk = new Animation();
		for (int i = 0; i < frames; i++) {
			this.walk.addFrame(s.getSprite(i, 0), time);
		}
		walk.setAutoUpdate(true);
		positionX = pX;
		positionY = pY;
		walkBehind = new Animation();
		for (int i = 0; i < frames; i++) {
			this.walkBehind.addFrame(
					s.getSprite(i, 0).getFlippedCopy(true, false), time);
		}
		walkBehind.setAutoUpdate(true);
		current = walk;
	}

	/**
	 * @return the current
	 */
	public Animation getCurrent() {
		return current;
	}

	/**
	 * @param current
	 *            the current to set
	 */
	public void setCurrent(Animation current) {
		this.current = current;
	}

	/**
	 * @return the walkBehind
	 */
	public Animation getWalkBehind() {
		return walkBehind;
	}

	/**
	 * @param walkBehind
	 *            the walkBehind to set
	 */
	public void setWalkBehind(Animation walkBehind) {
		this.walkBehind = walkBehind;
	}

	/**
	 * @return the walk
	 */
	public Animation getWalk() {
		return walk;
	}

	/**
	 * @param walk
	 *            the walk to set
	 */
	public void setWalk(Animation walk) {
		this.walk = walk;
	}

	/**
	 * @return the positionX
	 */
	public int getPositionX() {
		return positionX;
	}

	/**
	 * @param f
	 *            the positionX to set
	 */
	public void setPositionX(float f) {
		this.positionX = (int) f;
	}

	/**
	 * @return the positionY
	 */
	public int getPositionY() {
		return positionY;
	}

	/**
	 * @param y
	 *            the positionY to set
	 */
	public void setPositionY(float y) {
		this.positionY = (int) y;
	}
}
